package com.sxbbc.common.core.enums;

import java.util.ArrayList;
import java.util.List;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

/**
 * 
 * 转账业务类型
 * @author Wahyee
 */
public enum TransTypeEnums {
	B2C(1,"商家转账到用户"),
	AG_SHARE_TO_MONEY(101,"代理共享值转余额");
	
	private Integer id;
	 
    private String name;
    
    public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
 
	private TransTypeEnums(Integer id,String name){
		this.id=id;
		this.name=name;
	}
	
	public static String getName(Integer id){
		String str="";
		for(TransTypeEnums o:TransTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				str= o.getName();
				break;
			}
		}
		return str;
	}
	
	public static List<TransTypeEnums> queryList(){
		List<TransTypeEnums> list=new ArrayList<TransTypeEnums>();
		for(TransTypeEnums o:TransTypeEnums.values()){
			list.add(o);
		}
		return list;
	}
	
	
	public static TransTypeEnums getEnums(Integer paytype){
		for(TransTypeEnums o:TransTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(paytype, o.getId())){
				return o;
			}
		}
		return null;
	}
	
	
	public static boolean isPay(Integer id) {
		for(TransTypeEnums o:TransTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				return true;
			}
		}
		return false;
	}
}
